# Maintainer: Laurent Carlier <lordheavym@gmail.com>
# Contributor: Luca Bennati <lucak3 AT gmail DOT com>
# Contributor: Glaucous <glakke1 at gmail dot com>

pkgname=apitrace
pkgver=11.1
pkgrel=1
pkgdesc="Graphics API Tracing"
arch=('loong64' 'x86_64')
url="https://github.com/apitrace/apitrace"
license=('custom')
makedepends=('cmake' 'git' 'mesa' 'qt5-base')
depends=('python' 'libgl' 'procps-ng')
optdepends=('qt5-base: GUI support')
source=("$pkgname-$pkgver::git+https://github.com/apitrace/apitrace.git#tag=${pkgver}")
sha256sums=(SKIP)

prepare() {
  cd apitrace-${pkgver}

  git submodule update --init --depth 1 --recursive
}

build() {
  cd apitrace-${pkgver}

  cmake . -Bbuild -DCMAKE_INSTALL_PREFIX=/usr \
    -DENABLE_GUI=TRUE 
  make -C build
}

package() {
  cd apitrace-${pkgver}

  make -C build DESTDIR="${pkgdir}/" install

  install -m755 -d "${pkgdir}/usr/share/licenses/apitrace"
  install -m644 LICENSE "${pkgdir}/usr/share/licenses/apitrace/"
}
